<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
 <%@ page import="java.util.List" %>
<%@ page import="model.leave_message"%>
<%@ page import="dao.LeaveDao"%>   

<%
	//检查会话中是否有 "fdy" 属性
	Object fdyObj = session.getAttribute("fdy");
	if (fdyObj == null) {
	    response.sendRedirect("../view/Login.jsp");
	    return;
	}
%>
    
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>辅导员审核请假页面</title>
<link href="../css/Utils.css" rel="stylesheet" type="text/css" />
<link href="../css/List.css" rel="stylesheet" type="text/css" />
<!-- 退出登录专用 -->
   <script type="text/javascript" src="../view/Loginout.js"></script>
</head>
<body>


<!-- 头部 -->
<div class="header" ><br>
<nerong>&nbsp;&nbsp;辅导员页面&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;</nerong>
	<%
 		List<String> idclass = (List<String>)session.getAttribute("fdy");
 		String id = idclass.get(0);
    
 			%>
 	<button onclick="confirmLogout('<%= id %>','fdy')">退出登录</button>
</div><br>

<div class="left" >
<table width="80%" height="80%">
<th>
<nerong>辅导员可选择内容</nerong>

</th>
<tr>
<td>
<a href="../View_Msg/msgFdy.jsp">&emsp;个人信息</a><br>
</td>
</tr>

<tr>
<td>
<a href = "../View_SuShe/SuSheFDY_List.jsp">&emsp;学生宿舍信息查询</a><br>
</td>
</tr>
<tr>

<td>
<a href = "../View_WeiGui/WeiGuiFDY.jsp">&emsp;宿舍违规信息查询</a><br>

</td>
</tr>

<tr>
<td>
<a href = "../View_leave/T_leave.jsp">&emsp;请假信息处理</a><br>
</td>
</tr>


</table>


</div>


<div class="context" >
<!-- 这部分是每个大功能的小功能 -->

<div class="container">
        <h2>请假信息详情</h2>
       
         <%
         
         
      	// 获取URL参数中的编号
         String number = request.getParameter("number"); 
        
         
      // 检查编号是否为空
         if (number != null && !number.isEmpty()) { 
        	 
        	// 查询此条请假信息的具体内容（学生id、请假时间、状态、操作）
        	LeaveDao dao = new LeaveDao();
        	leave_message lm = dao.getOneLeaveMessages(number);                   
         
        	if(lm != null){
         
        %>
            
            
            <form class="leave-info-form" form action="../UpdateLeaveServlet" method="post">
            <div class="form-group">
                <label for="number">信息编码:</label>
                <input type="text" id="number" name="number" value="<%= lm.getNumber() %>" readonly>
            </div>
            <div class="form-group">
                <label for="course">课程:</label>
                <input type="text" id="course" value="<%= lm.getCourse() %>" readonly>
            </div>
            <div class="form-group">
                <label for="sdata">开始时间:</label>
                <input type="text" id="sdata" value="<%= lm.getSdata() %>" readonly>
            </div>
            <div class="form-group">
                <label for="edata">结束时间:</label>
                <input type="text" id="edata" value="<%= lm.getEdata() %>" readonly>
            </div>
            <div class="form-group">
                <label for="phone">联系方式:</label>
                <input type="text" id="phone" value="<%= lm.getPhone() %>" readonly>
            </div>
            <div class="form-group">
                <label for="reason">请假原因:</label>
                <textarea id="reason" readonly><%= lm.getReason() %></textarea>
            </div>
            <div class="form-group">
                <label for="go">是否出校:</label>
                <input type="text" id="go" value="<%= lm.getGo() %>" readonly>
            </div>
            <div class="form-group">
                <label for="address">离校地址:</label>
                <input type="text" id="address" value="<%= lm.getAddress() %>" readonly>
            </div>
            <div class="form-group">
                <label for="status">状态:</label>
                
                <select id="status" name="status" style="background-color:#fff;" >
                    <option value=""><%= lm.getStatus() %></option>
                    <option value="已通过">--通过--</option>
                    <option value="未通过">--拒绝--</option>
                    
                </select>            
            </div>
            <div class="form-group">
                <label for="refuse" >驳回原因:</label>
                <input type="text" id="refuse" style="background-color:#fff;" name="refuse" value="<%= lm.getRefuse() %>" > 
            </div>
            <div class="form-group">
                <button type="submit" >确认并返回</button>
            </div>
            
            
        </form>
            
       <%
            } else {
    %>
            <p>没有找到对应的请假信息。</p>
    <%
            }
        } else {
    %>
            <p>请提供有效的请假信息编号。</p>
    <%
        }
    %>
        
        
    </div>

</body>
</html>